-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new default date format #5163
Conversation
Signed-off-by: Fanit Kolchina <[email protected]>
@CaptainDredge Could you review this PR for technical accuracy? |
A date math expression contains a fixed date, optionally followed by one or more mathematical expressions. The fixed date may be either `now` (current date and time in milliseconds since the epoch) or a string ending with `||` that specifies a date (for example, `2022-05-18||`). The date must be in the `strict_date_time_no_millis||strict_date_optional_time||epoch_millis` format. | ||
|
||
If you specify multiple date formats in the field mapping, OpenSearch uses the first format to convert the milliseconds since the epoch value to a string. <br> | ||
If a field mapping for a field contains no format, OpenSearch uses `strict_date_optional_time` to convert the epoch value to a string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a field mapping for a field contains no format, OpenSearch uses `strict_date_optional_time` to convert the epoch value to a string. | |
If a field mapping for a field contains no format, OpenSearch uses `strict_date_optional_time` format to convert the epoch value to a string. |
@reta should we add here that user can revert to older format by disabling feature flag, would like to know your opinion |
@CaptainDredge Yes please, we have a new feature flag that should be documented, thank you. The 2.11 was cut, unless we get the green light to backport it to 2.11, this would be 2.12 feature. |
Signed-off-by: kolchfa-aws <[email protected]>
@CaptainDredge I have reworded to incorporate your suggestion. Please let me know:
|
Just an example of feature flags in the system (and how we document them) |
opensearch.experimental.optimization.datetime_formatter_caching.enabled
Note that the above feature flag is enabled by default, user has to disable it if he/she wants to go to the previous default formatter Disabling the feature flagThere are several methods for disabling the feature flag, depending on the installation type. Disable on a node using a tarball installationThe flag is toggled using a new jvm parameter that is set either in
Disable with Docker containersIf you're running Docker, add the following line to docker-compose.yml underneath the OPENSEARCH_JAVA_OPTS="-Dopensearch.experimental.optimization.datetime_formatter_caching.enabled=false"
Its enabled by default and therefore opensearch will use the new default format introduced along with an optimisation which cache last successfully parsed formatter to parse the datetime field for the next document getting indexed in the same shard. When the featureflag is disabled opensearch will use the old format along with disabling the above optimisation
I couldn't get the green light for the backport PRs to go in 2.11. I think it'll now go in 2.12 😞 |
@reta shouldn't we ideally have a common section for instructions on enabling and disabling feature flag instead of mentioning the process in every feature. This will allow us to just then document the new feature flag briefly with a relative link to the featureflag enable/disable documentation |
Totally, we could ask documentation team to help us with restructuring the docs to have common details on feature flags and than we could only mention the flag name(s) in the feature specific docs, @kolchfa-aws how does it sound? thank you! |
@reta Are all feature flags enabled in the same way? If so, we definitely need to put it in one place. |
@kolchfa-aws Yes all the feature flags are enabled in the same way |
All the same way, correct. |
@kolchfa-aws this change has been backported to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kolchfa-aws LGTM!
Signed-off-by: Fanit Kolchina <[email protected]>
@CaptainDredge @reta I added a "how to enable experimental features" section. Could you review this commit to make sure everything looks good? 03edad8. Then we can merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kolchfa-aws Just one comment. Thanks!
@@ -223,7 +227,7 @@ GET testindex/_search | |||
|
|||
The date field type supports using date math to specify durations in queries. For example, the `gt`, `gte`, `lt`, and `lte` parameters in [range queries]({{site.url}}{{site.baseurl}}/query-dsl/term/range/) and the `from` and `to` parameters in [date range aggregations]({{site.url}}{{site.baseurl}}/query-dsl/aggregations/bucket/date-range/) accept date math expressions. | |||
|
|||
A date math expression contains a fixed date, optionally followed by one or more mathematical expressions. The fixed date may be either `now` (current date and time in milliseconds since the epoch) or a string ending with `||` that specifies a date (for example, `2022-05-18||`). The date must be in the `strict_date_time_no_millis||strict_date_optional_time||epoch_millis` format. | |||
A date math expression contains a fixed date, optionally followed by one or more mathematical expressions. The fixed date may be either `now` (current date and time in milliseconds since the epoch) or a string ending with `||` that specifies a date (for example, `2022-05-18||`). The date must be in the [default format](#default-format), which by default is `strict_date_time_no_millis||strict_date_optional_time||epoch_millis`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last sentence might be a bit redundant (the default format by default is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but there are two options for the default format and one of them is the default one :)
Signed-off-by: Fanit Kolchina <[email protected]>
* Add new default date format Signed-off-by: Fanit Kolchina <[email protected]> * Update _field-types/supported-field-types/date.md Signed-off-by: kolchfa-aws <[email protected]> * Add enabling experimental features section Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: kolchfa-aws <[email protected]>
* Add new default date format Signed-off-by: Fanit Kolchina <[email protected]> * Update _field-types/supported-field-types/date.md Signed-off-by: kolchfa-aws <[email protected]> * Add enabling experimental features section Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: kolchfa-aws <[email protected]>
Fixes #5158
Checklist
For more information on following Developer Certificate of Origin and signing off your commits, please check here.